import BuffUtil from '@/BuffUtil';
import BuffCommon from 'code/Core/Common/BuffCommon';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/**
 * 长管火枪
 **/
export default class YX_LongerGun extends AbilityBase {
    static instance: YX_LongerGun;
    buffType: AppBuffType = {
        id: 'buff_YX_LongerGun',
        art: this.art,
        name: this.abilityName,
        ubertip: '增加你的射程',
        dur: 12,
        attribute: {},
        targetAttach: 'right hand',
        targetArt: 'Abilities\\Spells\\Items\\AIfb\\AIfbTarget.mdl',
    };
    constructor(id: string = 'Acgq') {
        super(id);
        YX_LongerGun.instance = this;
        this.init();
        se.onUnitSpellEffect(this.onSpellEffect.bind(this), this.id);
    }
    init() {
        BuffUtil.registerBuffType(this.buffType);
    }
    cast<T extends Object = any>(tarX: number, tarY: number, source: unit, target: unit, data?: T): void {
        // let buff = BuffUtil.addBuff(source, this.buffType.id, source);
        // buff.attribute.damage_range = 100 + 50 * this.getAbilityLevel(source);
        BuffCommon.addBuff({
            target: source,
            caster: source,
            buffTypeId: this.buffType.id,
            ablityId: this.id,
            attribute: {
                damage_range: 100 + 50 * this.getAbilityLevel(source),
            },
        });
    }
    onSpellEffect() {
        this.cast(GetSpellTargetX(), GetSpellTargetY(), GetTriggerUnit(), GetSpellTargetUnit());
    }
}
